import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.odps.udf.UDF;

public class SpliderExtractChinese extends UDF{

	public  String evaluate(String text) {
		//text= text.replace("、", " ");
		JSONObject  obj = new JSONObject();
		String regex = "[\\u4e00-\\u9fa5]";
		Pattern p = Pattern.compile(regex);
		Matcher m = p.matcher(text);
		StringBuffer chineseSb = new StringBuffer();
		StringBuffer sb = new StringBuffer();
		if (m.find()) {
			int start = m.start();
			String chinese = text.substring(start);
			obj.put("chinese", chinese);
			String english = text.replace(chinese, "");
			obj.put("english", english);
			System.out.println(JSON.toJSONString(obj));
			return JSON.toJSONString(obj);
		}
		return text;
	}
}